<template>
	<block v-if="!items.nr">
		<web-view :src="items.url"></web-view>
	</block>
	<block v-else>
		<div class='detailContent'>
			<div class='detail-title'>{{ items.bt }}</div> 
			<div class='detail-title-sub'>{{ items.ly +'  ' }}{{ items.rq }}</div>
			<!-- <image src="{{ items.slt }}" wx:if="{{ items.slt }}" class='detail-image' mode="widthFix" alt="没有图片"></image> -->
			<rich-text :nodes="nr" class='detail-cont'></rich-text>
	    <div class='file-content' v-if="fileList.length !== 0">
	      <text class='file-text'>附件：</text>
	      <div class='file-items-list' v-for='(item, index) in fileList' :key='index'>
	        <div class="file-icon">
	          <block v-if="item.fileType === '0'">
	            <image src="https://cdn.xtde.cn/wxapp/attach/txt.png" class="top-icon"></image>
	          </block>
	          <block v-if="item.fileType === '1'">
	            <image src="https://cdn.xtde.cn/wxapp/attach/doc.png" class="top-icon"></image>
	          </block>
	          <block v-if="item.fileType === '2'">
	            <image src="https://cdn.xtde.cn/wxapp/attach/xls.png" class="top-icon"></image>
	          </block>
	          <block v-if="item.fileType === '3'">
	            <image src="https://cdn.xtde.cn/wxapp/attach/pdf.png" class="top-icon"></image>
	          </block>
	        </div>
	        <div class='file-name' :data-fileUrl='item.fileUrl' bindtap='downloadFile'>
	          {{item.fileName}}
	        </div>
	      </div>
	    </div>
	    <div style='text-indent:40rpx;padding: 20rpx 0;line-height:2; font-size:20rpx;color:#999'>
			本文仅代表原作者个人观点，部分图片、内容来源于网络，版权归原作者所有，如有侵权，请告知删除。</div>
		</div>
	  <footer />
	</block>
</template>

<script>
	export default {
		name: 'ShowDetail',
		props: {
			items: Object,
			fileList: Array,
			nr: String
		},
		onLoad() {
			console.log('公共详情组件', this.items)
		},
		methods: {
			downloadFile: function (e) {
				app.globalData.isReload.isShare = true
		    // console.log('result: ',app, e)
				wx.downloadFile({
					url: e.target.dataset.fileurl, //下载资源的地址网络
					success: function (res) {
						wx.openDocument({
							filePath: res.tempFilePath,
							success: function (res) {
							
							}
						})
					}
				})
			}
		}
	}
</script>

<style>
</style>
